#pragma once
#include<iostream>
#include<assert.h>
using namespace std;

class Date {
public:
	friend int YearNumber(const Date& sd1, const Date& sd2);
	friend ostream& operator<<(ostream& out,const Date& sd);
	friend istream& operator>>(istream& in, Date& sd);
	Date(int year = 2000, int month = 1, int day = 1) {
		_year = year;
		_month = month;
		_day = day;
		cout << "Date(int year = 2000, int month = 1, int day = 1) " << endl;
	}
	Date(const Date& sd) {
		this->_year = sd._year;
		_month = sd._month;
		_day = sd._day;
		cout << "Date(const Date& sd) " << endl;
	}
	bool operator<(const Date& sd)const;
	bool operator==(const Date& sd)const;
	bool operator!=(const Date& sd)const;
	bool operator<=(const Date& sd)const;
	bool operator>(const Date& sd)const;
	bool operator>=(const Date& sd)const;


	Date& operator++();
	Date operator++(int);

	int GetMonthDay(int year, int month)
	{
		assert(month > 0 && month < 13);
		int monthday[13] = { -1,31,28,31,30,31,30,31,31,30,31,30,31};
		if (month == 2 &&((year % 4 == 0 && year % 100 != 100)
			|| year % 400 == 0))
			return 29;
		return monthday[month];
	}
	Date operator+(int day);
	Date& operator+=(int day);
	Date operator-(int day);
	Date& operator-=(int day);

	~Date()
	{
		cout << "~Date()" << endl;
	}
	void Print()
	{
		cout << _year << "/" << _month << "/" << _day << endl;
	}
private:
	int _year;
	int _month;
	int _day;
};

int YearNumber(const Date& sd1, const Date& sd2);
ostream& operator<<(ostream& out, const Date& sd); 
istream& operator>>(istream& in, Date& sd);